package rsj.interceptor;

import com.rlyy.aibase.utils.base.Box;
import com.rlyy.aibase.utils.base.MapNode;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;

/**
 * API白名单-不校验权限
 * 例：登录接口
 *
 * @author yuanqinglong
 * @since 2021/5/28 11:00
 */
@Component
public class WhiteApiInterceptor implements MyInterceptor {



    @Override
    public boolean preHandle(Box in) throws Exception {
        MapNode user = in.getMapNode("$user");
        // 如果没携带User_Id 网关不校验sso 为白名单api
        String userId = user.getValue("User_Id");
        return StringUtils.isBlank(userId);
    }
}
